function quantityLembur(number){
				var hargavalue = Number($('#hargabrg_'+number).val().replace(/[^0-9]+/g,""));
				
				var diskon = 0;
								var total1=0;
				var banyaktotal=0;
				var isChecked1 =0;
				var isChecked2 =0;
				var finalreal=0;
				harga = hargavalue*$('#q_'+number).val();
				hargaamount = changeFormat(harga);
				
				$('#amount_'+number).val(hargaamount);
				var discount = $('#disc_'+number).val();
				if(discount!=""){
					jumlahdiscount = harga*discount/100;
					jumlahdiscounttampil = changeFormat(jumlahdiscount);	
					$('#jumlahdisc_'+number).val(jumlahdiscounttampil);
					final = harga-jumlahdiscount;
					finalreal = harga-jumlahdiscount;
					isChecked1 = $('#tax1_'+number).attr('checked')?true:false;
					isChecked2 = $('#tax2_'+number).attr('checked')?true:false;
					if (isChecked1==1 && isChecked2==1){
						jumlahTax2 = final*0.05;
						jumlahTax1 = (jumlahTax2+final)*0.1;
						
						$('#jumtax1_'+number).val(jumlahTax1);
						$('#jumtax2_'+number).val(jumlahTax2);
						
						final = final + (finalreal*0.05);
						//final=final.toFixed(0);
						final = final + (final*0.1);
						final=final.toFixed(0);
						banyakTotalDisplay = changeFormat(final);
						$('#finalamt_'+number).val(banyakTotalDisplay);
							
								
					}else if (isChecked1==0 && isChecked2==1){
						jumlahTax1 = 0;
						jumlahTax2 = final*0.02;
						$('#jumtax1_'+number).val(jumlahTax1);
						$('#jumtax2_'+number).val(jumlahTax2);
						final = final + (finalreal*0.02);
						final=final.toFixed(0);
						banyakTotalDisplay = changeFormat(final);
						$('#finalamt_'+number).val(banyakTotalDisplay);
							
								
					}else if (isChecked1==1 && isChecked2==0){
						jumlahTax1 = final*0.1;
						jumlahTax2 = 0;
						$('#jumtax1_'+number).val(jumlahTax1);
						$('#jumtax2_'+number).val(jumlahTax2);
						final = final + (finalreal*0.1);
						final=final.toFixed(0);
						
						banyakTotalDisplay = changeFormat(final);
						$('#finalamt_'+number).val(banyakTotalDisplay);
							
								
					}else{
						jumlahTax1 = 0;
						jumlahTax2 = 0;
						$('#jumtax1_'+number).val(jumlahTax1);
						$('#jumtax2_'+number).val(jumlahTax2);
						finalShow=changeFormat(final);
						$('#finalamt_'+number).val(finalShow);
					}
					
					
					
				}
				else{
					final = harga;
					finalReal = harga
					isChecked1 = $('#tax1_'+number).attr('checked')?true:false;
					isChecked2 = $('#tax2_'+number).attr('checked')?true:false;
					if (isChecked1==1 && isChecked2==1){
						jumlahTax2 = final*0.05;
						jumlahTax1 = jumlahTax2*0.1;
						
						$('#jumtax1_'+number).val(jumlahTax1);
						$('#jumtax2_'+number).val(jumlahTax2);
						final = final + (finalreal*0.05);
						final = final + (final*0.1);
						
						final=final.toFixed(0);
						banyakTotalDisplay = changeFormat(final);
						$('#finalamt_'+number).val(banyakTotalDisplay);
							
								
					}else if (isChecked1==0 && isChecked2==1){
						jumlahTax1 = 0;
						jumlahTax2 = final*0.02;
						$('#jumtax1_'+number).val(jumlahTax1);
						$('#jumtax2_'+number).val(jumlahTax2);
						final = final + (finalreal*0.02);
						final=final.toFixed(0);
						banyakTotalDisplay = changeFormat(final);
						$('#finalamt_'+number).val(banyakTotalDisplay);
							
								
					}else if (isChecked1==1 && isChecked2==0){
						jumlahTax1 = final*0.1;
						jumlahTax2 = 0;
						$('#jumtax1_'+number).val(jumlahTax1);
						$('#jumtax2_'+number).val(jumlahTax2);
						final = final + (finalreal*0.1);
						final=final.toFixed(0);
						
						banyakTotalDisplay = changeFormat(final);
						$('#finalamt_'+number).val(banyakTotalDisplay);
							
								
					}else{
						jumlahTax1 = 0;
						jumlahTax2 = 0;
						$('#jumtax1_'+number).val(jumlahTax1);
						$('#jumtax2_'+number).val(jumlahTax2);
						finalShow=changeFormat(final);
						$('#finalamt_'+number).val(finalShow);
					}
					
				}
				
				hitungTotal();
			}
			
			function hitungTotal(){
				var subtotal1=0;
				var subtotaldisc =0;
				var subtax1=0;
				var subtax2=0;
				var totalamt=0
				var subbayar1=0;
				var rowCount = $('#itemShow tr').length;
				rowCount =parseInt(rowCount);
				for(var x = 1; x<rowCount; x++){
				
					if($('#jumlahdisc_'+x).val()==""){}
					else{
						banyakdiskon =  Number( $('#jumlahdisc_'+x).val().replace(/[^0-9]+/g,""));
						banyakdiskon = parseInt(banyakdiskon);
						diskon = banyakdiskon;
						subtotaldisc = parseInt(subtotaldisc) +diskon;
							
						
						
					}
					if($('#finalamt_'+x).val()==""){}
					else{
								
						banyaktotal =  Number( $('#finalamt_'+x).val().replace(/[^0-9]+/g,""));
						banyaktotal = parseInt(banyaktotal);
						total1 = banyaktotal;
						subtotal1 = parseInt(subtotal1) +total1;
					}
					
					if($('#amount_'+x).val()==""){}
					else{
								
						totalamt =  Number( $('#amount_'+x).val().replace(/[^0-9]+/g,""));
						totalamt = parseInt(totalamt);
						total1 = totalamt;
						subbayar1 = parseInt(subbayar1) +total1;
					}
					
					if($('#jumtax1_'+x).val()==""){}
					else{
								
						//totaltax1 =  Number( $('#jumtax1_'+x).val().replace(/[^0-9]+/g,""));
						totaltax1 = parseInt($('#jumtax1_'+x).val());
						tax1 = totaltax1;
						subtax1 = parseInt(subtax1) +tax1;
					}
					
					if($('#jumtax2_'+x).val()==""){}
					else{
								
						//totaltax2 =  Number( $('#jumtax2_'+x).val().replace(/[^0-9]+/g,""));
						totaltax2 = parseInt( $('#jumtax2_'+x).val());
						tax2 = totaltax2;
						subtax2 = parseInt(subtax2) +tax2;
					}
				}
				hutang = Number($('#hutang').val().replace(/[^0-9]+/g,""));
				subbayar1 = subbayar1-hutang
				untung = subtotal1-subbayar1
				subtotal1shot = changeFormat(subtotal1);
				subtotaldiscshot = changeFormat(subtotaldisc);
				
				subtax1 = Math.ceil(subtax1);
				subtax2 = Math.ceil(subtax2);
				subtax1shot=subtax1;
				subtax2shot=subtax2;
				subbayar1shot=changeFormat(subbayar1);
				untungshot=changeFormat(untung);
				$('#discountTotal').val(subtotaldiscshot);
				$('#subTotal').val(subtotal1shot);
				$('#tax2total').val(subtax2shot);
				$('#tax1total').val(subtax1shot);
				$('#tax1total').val(subtax1shot);
				$('#totalreal').val(subtotal1shot);
				$('#deposit').val(subbayar1shot);
				$('#totalAkhir').val(untungshot);
			}
			function taxing1(number){
					banyaktotal =  Number( $('#finalamt_'+number).val().replace(/[^0-9]+/g,""));
					var isChecked = $('#tax1_'+number).attr('checked')?true:false;
					if (isChecked==1){
						jumlahTax1 = banyaktotal*0.1;						
						
						$('#jumtax1_'+number).val(jumlahTax1);						
						banyaktotal = banyaktotal + (banyaktotal*0.1);
					}else{
						jumlahTax1 =0;						
						$('#jumtax1_'+number).val(jumlahTax1);	
						banyaktotal = banyaktotal / 1.1;
					}
					banyaktotal=banyaktotal.toFixed(0);
					banyakTotalDisplay = changeFormat(banyaktotal);
					 $('#finalamt_'+number).val(banyakTotalDisplay);
					 hitungTotal();
			}
			function taxing2(number){
					banyaktotal =  Number( $('#finalamt_'+number).val().replace(/[^0-9]+/g,""));
					var isChecked = $('#tax2_'+number).attr('checked')?true:false;
					if (isChecked==1){
						jumlahTax2 = banyaktotal*0.02;						
						$('#jumtax2_'+number).val(jumlahTax2);	
						banyaktotal = banyaktotal + (banyaktotal*0.02);
					}else{
						jumlahTax2 = 0;						
						$('#jumtax2_'+number).val(jumlahTax2);	
						banyaktotal = banyaktotal / 1.02;
					}
					banyaktotal=banyaktotal.toFixed(0);
					banyakTotalDisplay = changeFormat(banyaktotal);
					 $('#finalamt_'+number).val(banyakTotalDisplay);
					 hitungTotal();
			}
			function kurangDeposit(){
				bayarReal = Number($('#subTotal').val().replace(/[^0-9]+/g,""));
				deposit = Number($('#deposit').val().replace(/[^0-9]+/g,""));
				
				bayarkurang = parseInt(bayarReal)- parseInt(deposit);
				bayarKurangShow = changeFormat(bayarkurang);
				depositShow = changeFormat(deposit);
				$('#deposit').val(depositShow);
				$('#totalAkhir').val(bayarKurangShow);
			}
		
			
			function changeFormat(num){
				var num
				num = num.toString().replace(/\$|\,|\./g,''); 
				if(isNaN(num)) 
					num = "0"; 
				sign = (num == (num = Math.abs(num))); 
				num = Math.floor(num*100+0.50000000001); 
				num = Math.floor(num/100).toString(); 
			
				for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++) 
				num = num.substring(0,num.length-(4*i+3))+'.'+ num.substring(num.length-(4*i+3)); 
				var akhirDP = ((sign)?'':'-') + num;
				return akhirDP;
			}
		
		   $(function() {
				var scntDiv = $('#itemShow');
				
				var i = $('#itemShow tr').length;
				var j = $('#itemShow tr').length-1;
				var brg ="";
				
				$('#addScnt').live('click', function() {
						
						var row = "";
								row+="<tr id=\"baris_"+i+"\">";
								row+="<td><input type=\"button\" value=\"Hapus\" id=\"delrow_"+i+"\" onclick=\"javascript:removetr("+i+")\" /></td>";
								
								
								
								
								row+="<td style=\"display:none\"><input type=\"text\"  id=\"kodebrg_"+i+"\" name=\"kodebrg_"+i+"\" class=\"brgList\" size=\"11\"/><input type=\"text\" class=\"brgList\" id=\"kodebrgprt_"+i+"\" name=\"kodebrgprt_"+i+"\" name=\"kodebrgprt_"+i+"\" style=\"display:none\"/></td>";
								row+="<td><input type=\"text\"  id=\"descbrg_"+i+"\" name=\"descbrg_"+i+"\" class=\"brgList\" size=\"26\"/></td>";
								row+="<td><input type=\"text\" class=\"brgList\" id=\"q_"+i+"\" name=\"q_"+i+"\" onkeyup=\"javascript:quantityLembur("+i+")\" size=\"3\"/></td>";
								row+="<td id=\"harga"+j+"\"><input type=\"text\"  style=\"text-align:right\" id=\"hargabrg_"+i+"\"  name=\"hargabrg_"+i+"\" class=\"brgList\" size=\"11\" onkeyup=\"javascript:quantityLembur("+i+")\"/></td>";
								/*var y = document.getElementById("harga"+j);
    							y.innerHTML = "asd";*/
							
							   
								row+="<td><input type=\"text\" style=\"text-align:right\" id=\"amount_"+i+"\" disabled=\"disabled\" class=\"brgList\" size=\"14\"/></td>";
								row+="<td style=\"display:none\"><input type=\"text\" id=\"disc_"+i+"\" name=\"disc_"+i+"\" onkeyup=\"javascript:quantity("+i+")\" class=\"brgList\" size=\"4\"/></td>";
								row+="<td style=\"display:none\"><input type=\"text\" class=\"brgList\" id=\"jumlahdisc_"+i+"\"  size=\"9\" disabled=\"disabled\"/></td>";
								row+="  <td style=\"display:none\"><input type=\"checkbox\" class=\"brglist\" id=\"tax1_"+i+"\" name=\"tax1_"+i+"\" onclick=\"javascript:quantity("+i+")\"/><input type=\"text\" class=\"brglist\" id=\"jumtax1_"+i+"\" name=\"jumtax1_"+i+"\" style=\"display:none\"/></td>";
								row+="  <td style=\"display:none\"><input type=\"checkbox\" class=\"brglist\" id=\"tax2_"+i+"\" name=\"tax2_"+i+"\" onclick=\"javascript:quantity("+i+")\"/><input type=\"text\" class=\"brglist\" id=\"jumtax2_"+i+"\" name=\"jumtax2_"+i+"\" style=\"display:none\"/></td>";
								row+="<td><input type=\"text\" style=\"text-align:right\"  class=\"brgList\" disabled=\"disabled\"  id=\"finalamt_"+i+"\" size=\"12\"/></td>";
                        row+="</tr>";
						$("#itemShow > tbody").append($(row));
						
						i++;
						j++;
						return false;
				});
				
				$('#remScnt').live('click', function() {
						if( i > 2 ) {
								$(this).parents('p').remove();
								i--;
						}
						return false;
				});
			});
			
			
			/*$('#1').live('click', function() {
				removetr(this.id);
			});*/
			
			
			function removetr(row){
				$('#baris_'+row).hide();
				$('#q_'+row).val(0);
				quantity(row);
			}
				